# Created by 黄景涛
# DATE: 2025/3/7
import requests
import warnings

from typing import Union
from os import PathLike
from faker import Faker

from utils.log.logger import logger


class BaseRequest:
    session = requests.session()
    fk = Faker(locale='zh-CN')
    _instance = None

    # def __new__(cls, *args, **kwargs):
    #     """ 单例模式 """
    #     if cls._instance is None:
    #         return super().__new__(cls)
    #     return cls._instance

    def __init__(self, metadata: dict, t_cls: object, t_module: object):
        """
        :param metadata: 用例元数据
        :param t_cls: test类对象
        :param t_module: test模块对象
        """
        self.t_cls = t_cls
        self.t_module = t_module
        self.case = metadata
        self.case.update(
            original_info={},
            response_info={}
        )

    def __repr__(self):
        return f'<{self.__class__.__name__}  用例名称={self.case.get("name", "默认用例名")}>'

    def _verify(self):
        """ 用例数据验证 """

    def _hot_load(self):
        """ 变量占位替换 """

    def _save_variable(self, variable_file: Union[str, bytes, PathLike]):
        """ 保存变量 """

    def _assertion(self):
        """ 响应断言 """

    def send_request(self):
        """ 发送请求 """

    def full_request(self):
        """ 请求响应的完整流程 """



if __name__ == '__main__':
    pass
